package backed.repository;

import backed.entity.EcoBehavior;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public interface BehaviorRepository extends JpaRepository<EcoBehavior, Long> {

    /**
     * 根据用户ID查询在日期范围内的记录
     */
    List<EcoBehavior> findByUserIdAndRecordDateBetween(Long userId, LocalDate startDate, LocalDate endDate);
    
    /**
     * 查询用户的所有环保行为记录
     */
    List<EcoBehavior> findAllByUserId(Long userId);
    
    /**
     * 查询在日期范围内的所有环保行为记录
     */
    List<EcoBehavior> findAllByRecordDateBetween(LocalDate startDate, LocalDate endDate);
}
